home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-10 | 32.7 KB | 978 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Sun, 02 Jun 96 Volume 3 : Issue 148
-
- Today's Topics:
-
- Alt.Sources.Mac Archive Updated...
- EventAvail alternatives wanted
- Finding Apps In Desktop DB?
- Finding the caller of a CFM sharedlib?
- If you don't want to *wait* for events...
- MacFS: A Portable Macintosh Filesystem
- Serial port in use?
- Tiny Object Framework anyone?
- Web page for Macsbug tips
- [SOURCE] MicroMovie (was: HELP! with QuickTime)
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
- (pottier@clipper.ens.fr).
-
- The digest is a collection of article threads from the internet
- newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
- csmp.games. It is designed for people who read news semi-regularly and
- want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. If you don't have access to news, you
- may still be able to post messages to the group by using a mail server
- like anon.penet.fi (mail help@anon.penet.fi for more information).
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- nef.ens.fr). Article threads are not added to the digest until the last
- article added to the thread is at least two weeks old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The digests can be obtained by email, ftp or through the World Wide Web.
-
- If you want to receive the digest by mail, send email to listserv@ens.fr
- with no subject and one of the following commands as body:
- help Sends you a summary of commands
- subscribe csmp-digest Your Name Adds you to the mailing list
- signoff csmp-digest Removes you from the list
- Once you have subscribed, you will automatically receive each new
- issue as it is created.
-
- Back issues are available by ftp from Info-Mac mirror sites in the
- per/csmp subdirectory, e.g.
-
- ftp://sumex-aim.stanford.edu/info-mac/per/csmp/
-
- The contents of all back issues can be searched by accessing the
- following URL, courtesy of Andrew Barry (ajbarry@ozemail.com.au):
-
- http://marvin.stattech.com.au/search.html
-
- -------------------------------------------------------
-
- >From dnebing@epix.net
- Subject: Alt.Sources.Mac Archive Updated...
- Date: 16 May 1996 16:21:38 -0700
- Organization: Alt.Sources.Mac Archive
-
- I have recently finished updating a good portion of the alt.sources.mac
- archive. Stop by for a visit and see what's new...
-
- <ftp://ftp.ambrosiasw.com/pub/alt.sources.mac/>
- <http://www.ambrosiasw.com/alt.sources.mac/>
-
- Dave Nebinger
- *The* Alt.Sources.Mac Archivist
-
- ---------------------------
-
- >From andre.horstmann@unifr.ch (Andre Horstmann)
- Subject: EventAvail alternatives wanted
- Date: Wed, 08 May 1996 21:28:19 +0200
- Organization: University of Fribourg, Switzerland
-
-
- I need fast alternatives to the toolcall EventAvail. Up to now I used the
- (documented) global variable EventQueue (0x014A) to see whether the queue
- is empty (which then means: no events available).
-
- Unfortunately an empty queue does not hold information about the mouse
- position and the modifiers, as EventAvail would do! Is there any way (e.g.
- global variables) to check for these.
-
- Thanks for your help.
-
- Andre
-
- --
- mailto:andre.horstmann@unifr.ch - http://www.swix.ch/clan/shadow/ (11.4.96)
-
- The worst about computers: they never admit being responsible for an error.
-
- *** Fast Eddie Laboratories, Switzerland ***
-
- +++++++++++++++++++++++++++
-
- >From awiner@oracle.com (Adam Winer)
- Date: Wed, 08 May 1996 19:45:29 -0700
- Organization: Oracle Corporation
-
- In article <andre.horstmann-0805962128190001@news.swix.ch>,
- andre.horstmann@unifr.ch (Andre Horstmann) wrote:
-
- > I need fast alternatives to the toolcall EventAvail. Up to now I used the
- > (documented) global variable EventQueue (0x014A) to see whether the queue
- > is empty (which then means: no events available).
- >
- > Unfortunately an empty queue does not hold information about the mouse
- > position and the modifiers, as EventAvail would do! Is there any way (e.g.
- > global variables) to check for these.
-
- OSEventAvail() is much faster than EventAvail() (it doesn't
- give any time to background processes). A simple call of
- OSEventAvail(0, &event) should give you what you want.
-
- -- Adam Winer
- awiner@us.oracle.com
-
- ---------------------------
-
- >From sjohnson@macromedia.com (Steven Johnson)
- Subject: Finding Apps In Desktop DB?
- Date: Thu, 09 May 1996 14:43:45 -0500
- Organization: Macromedia
-
- If I have a file and and want to find the app(s) with the same creator,
- it's pretty easy (just call PBDTGetAppl).
-
- However, let's say I have a file with a bogus creator (e.g., ????) but a
- good filetype (e.g., PICT), and I want to find all the apps that claim to
- be able to open that filetype.
-
- Is there any good way of doing this, sort of a brute-force disk search?
-
- It appears that there isn't the inverse of PBDTGetAPPL, i.e.,
- PBDTGetAppsThatCanOpenThisFileType().
-
- Nor is there a PBDT call to index thru the applications (so that I could
- then use other PBDT calls to see what filetypes they support).
-
- There's obviously *some* way to get at this info, since both the Finder
- and the Translation Mgr do this. But I can't find it documented anywhere.
-
-
- Anyone responding, I'd appreciate you e-mailing a copy as well as a public
- posting. Thanks!
-
- --
- Steven Johnson |
- Senior Engineer | "Power lines have floaters
- Macromedia | so the airplanes won't get snagged."
- sjohnson@macromedia.com |
-
- +++++++++++++++++++++++++++
-
- >From aznemeng@godzilla.zeta.org.au (Andrew Nemeth)
- Date: 12 May 1996 20:49:50 GMT
- Organization: Kralizec Dialup Unix
-
- Steven Johnson (sjohnson@macromedia.com) wrote:
- : If I have a file and and want to find the app(s) with the same creator,
- : it's pretty easy (just call PBDTGetAppl).
- :
- : However, let's say I have a file with a bogus creator (e.g., ????) but a
- : good filetype (e.g., PICT), and I want to find all the apps that claim to
- : be able to open that filetype.
-
- : Is there any good way of doing this, sort of a brute-force disk search?
-
- Have a look at my 'AppLauncher' C++ code (especially the
- 'TLaunch' class) to see how I search both the desktop
- database and the file catalogue for files.
-
- The code is available from:
- o CW8 Reference CD
- o Celestin Apprentice IV CD
- o Info-mac dev/src
- o My WWW page
-
- Andrew N.
-
- Quicktime VR photography & services
- C++ & Java programming
- http://www.zeta.org.au/~aznemeng/
-
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 12 May 1996 18:33:54 -0400
- Organization: America Online, Inc. (1-800-827-6364)
-
- Steven Johnson wrote:
- >If I have a file and and want to find the app(s) with the same
- >creator, it's pretty easy (just call PBDTGetAppl).
- > However, let's say I have a file with a bogus creator (e.g.,
- >????) but a good filetype (e.g., PICT), and I want to find all
- >the apps that claim to be able to open that filetype.
- >
- >Is there any good way of doing this, sort of a brute-force disk
- >search?
- > It appears that there isn't the inverse of PBDTGetAPPL, i.e.,
- >PBDTGetAppsThatCanOpenThisFileType().
- >
- >Nor is there a PBDT call to index thru the applications (so that
- >I could then use other PBDT calls to see what filetypes they
- >support).
- > There's obviously *some* way to get at this info, since both
- >the Finder and the Translation Mgr do this. But I can't find it
- >documented anywhere.
- >
- >
- >Anyone responding, I'd appreciate you e-mailing a copy as well
- >as a public posting. Thanks!
-
- I've never messed with the Translation Manager, but I have worked with
- Desktop Manager and File Manager a lot, so I figured I'd give this a
- crack.
-
- It looks like the Translation Manager gives you a way to find out what
- file types a specified application can open - the
- GetFileTypesThatAppCanNdoesn't seem to be the inverse of that call - a
- function that given a target file, returns a list of applications that say
- they can open that file. If you're just wanting to open a specific file,
- the easiest thing to do would be to tell the Finder to open the file with
- an Apple Event. If the file's creator application isn't available and the
- Translation Manager is available, the user will be presented the
- "translation choices" dialog box where they can pick another application
- that says it can open that file type.
-
- However, if you really want to build the list yourself, I just wrote the
- code to build a list of applications that say they can open the target
- file. I've pasted the code for "GetAppsThatCanOpenDocNatively" into the
- next message. GetAppsThatCanOpenDocNatively isn't really fast because it
- calls GetFileTypesThatAppCanNativelyOpen once for each application
- ('APPL') it finds on all volumes.
-
- By the way, the code uses a routine from MoreFiles. If you don't have
- MoreFiles, here's its URL:
- <ftp://members.aol.com/JumpLong/MoreFiles_1.4.2.sea.hqx> If you find a bug
- in GetAppsThatCanOpenDocNatively, let me know so I can correct my copy of
- it.
-
- - Jim Luther
-
- jumplong@aol.com
- <http://members.aol.com/JumpLong/>
-
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 12 May 1996 18:33:57 -0400
- Organization: America Online, Inc. (1-800-827-6364)
-
- Here's the code for GetAppsThatCanOpenDocNatively.
-
- - Jim Luther
-
- jumplong@aol.com
- <http://members.aol.com/JumpLong/>
-
- - --------
-
- #include <Files.h>
- #include <Translation.h>
- #include "MoreFilesExtras.h"
-
- /* handle to array of FSSpecs */
- typedef FSSpecHandle FSSpecArrayHandle;
-
- pascal OSErr GetAppsThatCanOpenDocNatively(const FSSpec *targetDocument,
- FSSpecArrayHandle *appList, unsigned long *count)
- {
- enum
- {
- kIgnoreCreator = 0x00000000,
- kAPPLFileType = 'APPL',
- kMaxSpecs = 10
- };
-
- OSErr result, memMgrErr;
- FInfo fndrInfo;
- OSType targetFileType; /* file type of the target file */
- HParamBlockRec pb;
- short volIndex; /* for indexing through the list of mounted volumes */
- Boolean volDone; /* flag that indicates when we should stop looking for
- new volumes */
- FSSpec specs[kMaxSpecs]; /* an array for getting application FSSpecs */
- long actMatchCount; /* number of valid FSSpecs in specs array */
- long appIndex; /* for indexing through the list of applications on a
- volume */
- Boolean newSearch;
- TypesBlock nativeTypes; /* array of file types an application can open
- */
- short typeIndex; /* for indexing through the list of file types an
- application can open */
-
- /* No matches yet */
- *count = 0;
-
- /* Allocate handle for matches */
- *appList = (FSSpecHandle)NewHandle(0);
- if ( *appList != NULL )
- {
- /* What file type are we trying to open */
- result = FSpGetFInfo(targetDocument, &fndrInfo);
- if ( result == noErr )
- {
- targetFileType = fndrInfo.fdType;
-
- /* Index through the mounted volumes */
- pb.volumeParam.ioNamePtr = NULL;
- volIndex = 1;
- volDone = false;
- while ( !volDone )
- {
- pb.volumeParam.ioVolIndex = volIndex;
- if ( PBHGetVInfoSync(&pb) == noErr )
- {
- memMgrErr = noErr;
- newSearch = true;
- do
- {
- /* Find applications on this volume */
- result = CreatorTypeFileSearch(NULL, pb.volumeParam.ioVRefNum,
- kIgnoreCreator, kAPPLFileType,
- specs, kMaxSpecs, &actMatchCount, newSearch);
- if ( (result == noErr) || (result == eofErr) )
- {
- /* Look at each application found */
- for ( appIndex = 0; appIndex < actMatchCount; ++appIndex )
- {
- /* Get this application's creator type */
- if ( FSpGetFInfo(&(specs[appIndex]), &fndrInfo) == noErr )
- {
- /* Ask the Translation Manager what file types this application
- can open */
- if ( GetFileTypesThatAppCanNativelyOpen(pb.volumeParam.ioVRefNum,
- fndrInfo.fdCreator, (FileType *)&nativeTypes) == noErr )
- {
- /* Look through the FileTypes returned for the target's file
- type */
- typeIndex = 0;
- while ( nativeTypes[typeIndex] != 0 )
- {
- if ( nativeTypes[typeIndex] == targetFileType )
- {
- /* Add this application's spec to the list */
- memMgrErr = PtrAndHand(&(specs[appIndex]), (Handle)*appList,
- sizeof(FSSpec));
- ++(*count); /* Increment match count */
- break; /* while ( *nativeTypePtr != 0 ) */
- }
- ++typeIndex; /* next file type */
- }
- }
- }
- }
- newSearch = false; /* it's not a new search anymore */
- }
- } while ( (result == noErr) && (memMgrErr == noErr) );
-
- /* If there was a memory Manager error, bail out now */
- if ( memMgrErr == noErr )
- {
- if ( result == eofErr ) /* eofErr is OK */
- {
- result = noErr;
- }
- }
- else
- {
- result = memMgrErr;
- volDone = true;
- }
-
- ++volIndex; /* next volume */
- }
- else
- {
- volDone = true;
- }
- }
- }
-
- /* Dispose of handle if errors or if no matches */
- if ( (result != noErr) || (*count == 0) )
- {
- DisposeHandle((Handle)*appList);
- *appList = NULL;
- *count = 0;
- }
- }
- else
- {
- result = memFullErr;
- }
- return ( result );
- }
-
- ---------------------------
-
- >From mjv@mit.edu (Marshall Vale) (Marshall Vale)
- Subject: Finding the caller of a CFM sharedlib?
- Date: Thu, 09 May 1996 10:58:03 -0400
- Organization: Massachusetts Institute of Technology
-
- Hi,
-
- Is there a way to find out who the caller of a CFM shared library is? From
- reading through IM and a few other sources, there doesn't seem to be a
- good public way of doing. The purpose of this is to be able to do some
- tracking on a product that we don't have the source to, we're writing the
- dll. If the solution isn't clean, that's ok.
-
- TIA,
- Marshall
-
- Marshall Vale | mjv@mit.edu | "Das Schicksal des Mannes ist knusprig
- MacDevGuy, IS | Massachusetts Institute of Technology | und lecker."
-
- ---------------------------
-
- >From Robert van Uitert <robt@euronet.nl>
- Subject: If you don't want to *wait* for events...
- Date: 18 May 1996 00:29:37 GMT
- Organization: Three-Space Interactive
-
- /*
- Hi everyone,
-
- There seems to be some confusion about the slowness of getting events,
- the overhead of the Mac OS, having to quit the Finder for better
- performance, etc. I hope I can clear up some things.
-
- Below you will find the C++ code for a little program that tests the
- speed of the various event-retrieval methods (WaitNextEvent, etc.).
- Just compile and run it. You may learn something! I did! ;-)
-
- Before you compile it, you should set the kCyclesPerSec constant (in
- the first line of code) to your machine's clock speed.
-
- After running this program, you should note the following:
- - WaitNextEvent, GetNextEvent and EventAvail are faster when there's
- an updateEvt pending. I assume background apps are not given any time
- until the front app has handled all update events.
- - GetOSEvent is a *lot* faster than WNE/GNE. It's very uncooperative
- by not giving any time to background processes, but that's just fine
- for a game that takes over the screen/system. If low-level events
- (i.e. all events other than update, activate, suspend/resume, mouse-
- moved and high-level events) are all you need, then use GetOSEvent and
- do *not* use WNE/GNE.
- - GetOSEvent is slower (on my 6100/66 at least) than GetKeys, but if
- you also need the state of the mouse button, GetOSEvent is faster than
- GetKeys and Button combined.
-
- The fastest way of processing low-level events is to first check
- whether there's one available by looking at the qHead (or qTail) field
- of the event queue header (which you can get from GetEvQHdr,
- GetEventQueue or LMGetEventQueue), and then (if necessary) call either
- GetOSEvent or the low-level Dequeue function, as follows:
-
- if ((elem = (EvQElPtr)queue->qHead) != nil) {
- switch (elem->evtQWhat) {
- ...
- }
- Dequeue((QElemPtr)elem, queue);
- }
-
- The Dequeue function apparently also adds new events to the queue.
- This is pretty much undocumented, however, and for the sake of
- compatibility I wouldn't use this method in any commercial product.
- The following works just as well (or better):
-
- if (queue->qHead) {
- GetOSEvent(everyEvent, &event);
- switch (event.what) {
- ...
- }
- }
-
- Of course, the above won't do the job if you want null events too
- (e.g. to read the up-to-date state of the modifier keys); in that
- case, just call GetOSEvent without testing queue->qHead.
-
- Happy happy, joy joy,
-
- De ballen,
-
- Robt.
- */
-
-
- #define kCyclesPerSec 66000000 // For a 66 MHz CPU
- #define reg register
- #define Ticks (*(long *)0x16A)
-
- static long lengthOfCStr(reg char *s)
- {
- reg char *p = s - 1;
- while (*++p)
- ;
- return p - s;
- }
-
- void main()
- {
- #define TEST(code)\
- n = 0;\
- t = Ticks + 60;\
- do {\
- code\
- ++n;\
- } while (Ticks < t);\
- \
- MoveTo(50, qd.thePort->pnLoc.v + 20);\
- DrawText(#code, 0, lengthOfCStr(#code));\
- MoveTo(400, qd.thePort->pnLoc.v);\
- NumToString(n, s);\
- DrawString(s);\
- MoveTo(500, qd.thePort->pnLoc.v);\
- NumToString(kCyclesPerSec / n, s);\
- DrawString(s);
-
- MaxApplZone();
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
-
- SetPort(NewWindow(nil, &qd.screenBits.bounds, "\p", true,
- dBoxProc, (WindowPtr)-1, false, 0));
- TextFont(monaco);
-
- EventRecord event;
- KeyMap keyMap;
- Str255 s;
- reg long n, t;
- reg QHdrPtr queue = GetEventQueue();
-
- for (n = 0; n < 10; ++n)
- WaitNextEvent(everyEvent, &event, 1, nil);
-
- MoveTo(365, 40);
- DrawString("\piterations/sec");
- MoveTo(500, 40);
- DrawString("\pcycles/iteration");
-
- MoveTo(50, 70);
- DrawString("\pWith a pending updateEvt:");
- TEST( WaitNextEvent(everyEvent, &event, 0, nil); )
- TEST( GetNextEvent(everyEvent, &event); )
- TEST( EventAvail(everyEvent, &event); )
-
- for (n = 0; n < 10; ++n) {
- WaitNextEvent(everyEvent, &event, 1, nil);
- if (event.what == updateEvt) {
- BeginUpdate((WindowPtr)event.message);
- EndUpdate((WindowPtr)event.message);
- }
- }
- MoveTo(50, qd.thePort->pnLoc.v + 30);
- DrawString("\pAfter the updateEvt is handled:");
- TEST( WaitNextEvent(everyEvent, &event, 0, nil); )
- TEST( GetNextEvent(everyEvent, &event); )
- TEST( EventAvail(everyEvent, &event); )
-
- Move(0, 10);
- TEST( GetOSEvent(everyEvent, &event); )
- TEST( OSEventAvail(everyEvent, &event); )
- TEST( if (queue->qHead) GetOSEvent(everyEvent, &event); )
-
- Move(0, 10);
- TEST( GetKeys(keyMap); )
- TEST( Button(); )
-
- MoveTo(50, qd.thePort->pnLoc.v + 30);
- DrawString("\pTimer overhead:");
- TEST( ; )
-
- MoveTo(50, qd.thePort->pnLoc.v + 40);
- DrawString("\pPress the mouse button to quit");
- while (!Button())
- ;
- FlushEvents(everyEvent, 0);
- }
-
- +++++++++++++++++++++++++++
-
- >From Andrew Edward White <andreww>
- Date: 20 May 1996 03:03:08 GMT
- Organization: School of CompSci & Eng, Uni Of NSW, Oz
-
- In article <319D1A1A.49D6@euronet.nl> Robert van Uitert <robt@euronet.nl> writes:
- >
- >After running this program, you should note the following:
- >- WaitNextEvent, GetNextEvent and EventAvail are faster when there's
- >an updateEvt pending. I assume background apps are not given any time
- >until the front app has handled all update events.
-
- Yes. Not handling update events is a great way to lock up your
- communications software (or other time critical background processes).
-
- --
- Andrew White
- andreww@cse.unsw.edu.au
- http://www.cse.unsw.edu.au/~andreww/
- "A complex problem is merely a simple hierarchy of simple problems"
-
- ---------------------------
-
- >From pdinda@cs.cmu.edu (Peter A. Dinda)
- Subject: MacFS: A Portable Macintosh Filesystem
- Date: Thu, 09 May 1996 14:41:12 GMT
- Organization: Carnegie Mellon University SCS
-
-
- MacFS: A Portable Macintosh Filesystem
-
- Copyright (c) 1996 by Peter A. Dinda, George C. Necula, and Morgan Price
-
- Many moons ago, George C. Necula, Morgan Price, and I built a Macintosh
- Heirachical File System implementation with an eye towards portability. For a
- variety of reasons, mostly time constraints and because none of our respective
- research areas encompasses filesystem design and implementation, MacFS has been
- sitting on a shelf until now. We have decided to dust it off and make it
- available to the net. We hope that some young hackers with more time on their
- hands than we have will port it to Linux, FreeBSD, NetBSD, OS/2, NT, etc.
-
- MacFS is a complete (read/write) filesystem library which can be used to build
- user-level and kernel-level support for Macintosh volumes. Included in the
- distribution are user-level utilities (ls/cp/etc), as well as a very alpha Mach
- vfs (ie, vnode) built on top of the library. The code has been tested on
- PMAX/Mach 3.0 machines and Intel/NetBSD machines.
-
- The source code for MacFS 0.1 and a technical report describing MacFS are
- available via the "Programs" icon on the web page:
-
- http://www.cs.cmu.edu/afs/cs.cmu.edu/usr/pdinda/html/pdinda.html
-
- The source code is also available by ftp via:
-
- ftp://ftp.cs.cmu.edu/user/pdinda/
-
- Please read the (very liberal) license agreement available in each of these
- locations. Let us know if this code is useful to you. Included below is the
- abstract for the tech report:
-
-
- We have created a Macintosh file system library which is portable to a
- variety of operating systems and platforms. It presents a programming
- interface sufficient for creating a user level API as well as file
- system drivers for operating systems that support them. We
- implemented and tested such a user level API and utility programs
- based on it as well as an experimental Unix Virtual File System.
-
- We describe the Macintosh Hierarchical File System and our
- implementation and note that the design is not well suited to
- reentrancy and that its complex data structures can lead to slow
- implementations in multiprogrammed environments. Performance
- measurements show that our implementation is faster than the native
- Macintosh implementation at creating, deleting, reading and writing
- files with small request sizes, but slower than the Berkeley Fast File
- System (FFS.) However, the native Macintosh implementation can
- perform large read and write operations faster that either our
- implementation or FFS.
-
-
-
- Peter August Dinda pdinda@cs.cmu.edu
- Doctoral Student, School of Computer Science, Carnegie Mellon University
- http://www.cs.cmu.edu/afs/cs.cmu.edu/usr/pdinda/html/pdinda.html
-
- Peter August Dinda pdinda@cs.cmu.edu
- Doctoral Student, School of Computer Science, Carnegie Mellon University
- http://www.cs.cmu.edu/afs/cs.cmu.edu/usr/pdinda/html/pdinda.html
-
-
- ---------------------------
-
- >From plang@com.mcnet.ch (Philippe Lang)
- Subject: Serial port in use?
- Date: Thu, 02 May 1996 16:12:39 +0200
- Organization: EPFL
-
- How can I know if a serial port is already in use, before opening it? I
- thought this would be an easy job, but I haven't succeeded. The piece of
- code I found in the developer CD does not work, and the device manager
- OpenDriver routine does not return "portInUse".
-
- I'm using system software 7.5.3.
-
- Thanks
-
- --
- Philippe Lang
- SWITZERLAND
-
- +++++++++++++++++++++++++++
-
- >From sbower@teleport.com (Steve Bower)
- Date: 3 May 1996 23:56:53 GMT
- Organization: Teleport - Portland's Public Access (503) 220-1016
-
- "portInUse" is a low-level (in PRAM) state flag that tells the OS when
- certain kinds of drivers are active and may be using the serial hardware
- ports. E.G. AppleTalk, Serial, or None. Is this really the information
- you want? Or are you trying to use the serial driver and want know if
- another application is already using it?
-
- If the latter, the short answer is -- you can't find out unless you are
- using the Communications Toolbox. Apple didn't provide any mechanism for
- arbitrating hardware ports when they designed the Mac OS. The CTB was an
- attempt to rectify that problem -- with mixed results.
-
- -Steve
-
-
- In article <plang-0205961612390001@phlang.dial.mcnet.ch>,
- plang@com.mcnet.ch (Philippe Lang) wrote:
-
- > How can I know if a serial port is already in use, before opening it? I
- > thought this would be an easy job, but I haven't succeeded. The piece of
- > code I found in the developer CD does not work, and the device manager
- > OpenDriver routine does not return "portInUse".
- >
- > I'm using system software 7.5.3.
- >
- > Thanks
- >
- > --
- > Philippe Lang
- > SWITZERLAND
-
- --
- -Steve sbower@teleport.com
-
- +++++++++++++++++++++++++++
-
- >From plang@com.mcnet.ch (Philippe Lang)
- Date: Sun, 05 May 1996 22:17:42 +0200
- Organization: EPFL
-
- In article <sbower-0305961657320001@ip-pdx03-43.teleport.com>,
- sbower@teleport.com (Steve Bower) wrote:
-
- > "portInUse" is a low-level (in PRAM) state flag that tells the OS when
- > certain kinds of drivers are active and may be using the serial hardware
- > ports. E.G. AppleTalk, Serial, or None. Is this really the information
- > you want? Or are you trying to use the serial driver and want know if
- > another application is already using it?
- >
- > If the latter, the short answer is -- you can't find out unless you are
- > using the Communications Toolbox. Apple didn't provide any mechanism for
- > arbitrating hardware ports when they designed the Mac OS. The CTB was an
- > attempt to rectify that problem -- with mixed results.
-
- Thanks Steve,
-
- Yes, I want to know if another application is already using a serial
- port... There is really no solution? Gosh. Is it possible to know the
- state of a serial port with the help of the Comm Toolbox, even if I'm not
- using the Comm Toolbox for sending data? I suppose no...
-
- --
- Philippe Lang
- SWITZERLAND
-
- +++++++++++++++++++++++++++
-
- >From cswan@actrix.gen.nz (Christopher Swan)
- Date: Thu, 09 May 1996 20:45:20 +1200
- Organization: Raine Storm Softworks
-
- >Yes, I want to know if another application is already using a serial
- >port... There is really no solution? Gosh. Is it possible to know the
- >state of a serial port with the help of the Comm Toolbox, even if I'm not
- >using the Comm Toolbox for sending data? I suppose no...
-
- In theory you can use the 'serial port arbitrator' that comes with ARA -
- but its never worked for me. The CTB does not really arbitrate serial
- ports (contrary to popular belief - although it does provide a
- 'IsDriverOpen' function) so the best solution is to 'walk' the driver
- entry table and find the driver you want to open and see if it is already
- open.
-
- --
-
- Cheers, Chris
-
- - ---------------------------------------------------------------------
- Christopher Swan CompuServe 100354,3427
- PO Box 11567, Wellington, New Zealand or Raine@kagi.com
- - ---------------------------------------------------------------------
-
- +++++++++++++++++++++++++++
-
- >From harun@village.village.de (Harun Scheutzow)
- Date: Thu, 9 May 1996 08:29:58 GMT
- Organization: Village Tronic Marketing GmbH
-
- You may look into the UTable and find the DCE (Device Control Entry).
- In the DCE there you find the information whether the driver is opened
- or closed. See IM Devices. Not very clean, but a possible solution for
- your problem.
-
- Regards, HS
- <Opinions are my own>
-
-
- +++++++++++++++++++++++++++
-
- >From sw@nan.co.uk (Sak Wathanasin)
- Date: Thu, 9 May 1996 21:37:53 GMT
- Organization: Network Analysis Ltd
-
- In article <plang-0205961612390001@phlang.dial.mcnet.ch>,
- plang@com.mcnet.ch (Philippe Lang) wrote:
-
- > How can I know if a serial port is already in use, before opening it? I
- > thought this would be an easy job, but I haven't succeeded. The piece of
- > code I found in the developer CD does not work, and the device manager
- > OpenDriver routine does not return "portInUse".
-
- It does if you have ARA installed. If it isn't, you are supposed to walk
- the device unit table, find the driver entry and
-
- "look at bit 5 of the low-order byte of the dCtlFlags field of the Serial
- Driver’s DCE"
-
- according to tech note DV555 - Serial driver Q & A. The ARA API manual says
-
- "When installed Remote Access provides serial port arbitration throught
- [sic!] the Serial Port Arbitrator tool. All serial drivers registered
- with the Communications Resource Manager are arbitrated by the Serial Port
- Arbitrator.
-
- To check to see if the Serial Port Arbitrator is installed, check the
- gestaltSerialArbitrationExists flag of the gestaltArbitorAttr Gestalt
- selector (see "Gestalts" section for these defines and an example of this
- call).
-
- If serial port arbitration is present, call OpenDriver when you want to
- use a serial port. If the driver requested is not open, OpenDriver will
- return a result of noErr and the reference number of the driver. If the
- driver requested is open (in use), OpenDriver will return the error
- portInUse. When you are finished using the driver, call CloseDriver.
- OpenDriver and CloseDriver calls should always be balanced, although the
- Serial Port Arbitrator will protect against multiple open/close calls.
-
- If serial port arbitration is not present, do not use OpenDriver to
- determine if the driver is open. It will return you a result of noErr and
- the reference number, allowing you access to a driver that another
- application is using. To determine if the serial driver requested is
- open by another application, you must walk the DCE (Device Control Entry)
- unit table (see Device Driver chapter of Inside Macintosh vol II)."
-
- The ARA API guide has sample code on how to do this (with or without ARA
- present), but I'm not sure if one is allowed to post it here (it's Apple's
- copyright, so I'll leave it to someone from Apple to post it). The ARA SDK
- is on the MacOS SDK CD which you can get from APDA.
-
- --
- Sak Wathanasin
- Network Analysis Limited
- 178 Wainbody Ave South, Coventry CV3 6BX, UK
-
- Internet: sw@nan.co.uk
- uucp: ...!britain.eu.net!nan!sw
- Phone: (+44) 1203 419996 Fax: (+44) 1203 690690
-
- ---------------------------
-
- >From IMPROVISION@applelink.apple.com (Graham)
- Subject: Tiny Object Framework anyone?
- Date: Thu, 16 May 1996 17:00:05 GMT
- Organization: (none)
-
-
- I have written a tiny object framework for writing mac app's in C++
- using CodeWarrior 8.0, mainly to teach my girlfriend OOP programming
- with a gentler learning curve than, say PowerPlant. You can knock up
- mac apps in minutes with it. (Four basic classes, plus one or two
- others).
-
- If anyone thinks this would be of use to them, I will release it as
- freeware, if the demand exists, so eMail me back, or simply repost your
- response.
-
- I would post it immedsiately, but all in it runs to about a meg of
- sources, etc., so I will spare the bandwidth for now.
-
- --Graham.
-
-
- ---------------------------
-
- >From crawford@scipp.ucsc.edu (Mike Crawford)
- Subject: Web page for Macsbug tips
- Date: 7 May 1996 21:46:25 GMT
- Organization: UC Santa Cruz - SCIPP
-
- I am working on a Web page for Macsbug tips and tricks. It's been
- around for a while with not much content. It still doesn't say
- much, but it does now answer the two most frequent questions I
- get from its readers:
-
- Where do I get Macsbug?
-
- Are there books about Macsbug?
-
- I brought this up a while back and many of you sent me your
- tricks and tips. I filed them away until I could get around to
- adding them. If you have a tip you'd like to submit to the
- page, or if you have a Macsbug or debugging web page that you'd
- like me to link to, please mail me at crawford@scruznet.com
-
- To visit the page, see:
-
- http://www.scruznet.com/~crawford/Computers/macsbug.html
-
- Best,
- --
- Mike Crawford | Free Mac source code. The Word Services
- crawford@scruznet.com | allows you to link to a speller or other
- crawford@maxwell.ucsc.edu | text service. See the W.S. home page at:
- http://www.scruznet.com/~crawford/WordServices/wdsvindex.html
-
-
- ---------------------------
-
- >From "Jim Cavera" <jim_cavera@bogie2.bio.purdue.edu>
- Subject: [SOURCE] MicroMovie (was: HELP! with QuickTime)
- Date: 6 May 96 13:57:33 -0500
- Organization: Purdue University
-
- Due to overwhelming demand, I'm posting the source to a tiny QuickTime
- app on my ftp-site. MicroMovie reads a series of PICTs from its resource
- fork and makes them into a QuickTime movie. It's small. It's simple.
- It's easily adaptable to other stuff (animation, converting PICS files,
- etc.).
- It's pretty well commented. It's not very pretty and it may be a bit
- buggy (geez, whad' you exepect? It took me all of a half hour). You
- can find it at :
-
- ftp://ibcrc5.bio.purdue.edu/FTP/Public/MicroMovie68K.sit.hqx
-
- If you have any problems getting it, feel free to drop me an e-line
- and I'll try to mail you a copy.
-
- Jim Cavera (bit-pushing slave)
- jim_cavera@bogie2.bio.purdue.edu
-
- P.S.: All of the MicroMovie stuff is in the public domain. If,
- however, you use it as the basis of a killer app and make a zillion
- dollars off it, I would appriciate some recognition ;-)
-
- P.P.S.: Also, you may want to check out the Tools Plus 3.0 eval
- kit at the same site. If you program a lot and have stupid people
- given rediculous deadlines, it will REALLY make your life
- easier.
-
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-
-
-
-